package com.zkw.ss.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by Administrator on 2016/5/3 0003.
 */
public class Servlet extends HttpServlet {
    private static final long serialVersionUID = -2567492095010366387L;

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("Servlet");
        resp.setContentType("text/html;charset=UTF-8");
        PrintWriter out=resp.getWriter();
        // Write some content
        out.println("<html>");
        out.println("<head>");
        out.println("<title>MyFirstServlet</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h2>Servlet MyFirstServlet at " + req.getContextPath() + "</h2>");
        out.println("</body>");
        out.println("</html>");
        out.close();

    }

    @Override
    public String getServletInfo() {
        return "Myfirstservlet";
    }
}
